home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / bbs / Hydra11s.lha / HBBS / Source / Common / structures.h < prev    next >
C/C++ Source or Header  |  1996-10-29  |  37KB  |  1,023 lines

  1. /*
  2.  
  3.  
  4.   to add
  5.  
  6.   *none*
  7.  
  8.   to remove
  9.  
  10.   anything with *R* next to it!
  11.  
  12. */
  13.  
  14. struct ScreenInfoData
  15. {
  16.     struct Screen *Scr;
  17.     V_BIGNUM ScrModeID;
  18.     V_BIGNUM ScrWidth;
  19.     V_BIGNUM ScrHeight;
  20.     V_BIGNUM ScrDepth;
  21.     V_STRING PubScreenName;
  22.     V_BOOL UsePubScreen;
  23. };
  24.  
  25.  
  26. // right, this is Soooo cool, basically a door calls the MenuPrompt() function
  27. // like this:
  28. // DOOR_MenuPrompt("Fruit [O]ranges, [B]ananas, [A]pples",'B')
  29. // where the B means that Banana's will be selected if the user just
  30. // presses return..
  31. //
  32. // then using the data in BBSCols we can change the output of the prompt
  33. // passed to MenuPrompt() before we display it, here's an example of
  34. // what each setting might be set to..
  35.  
  36.  
  37. struct BBSColsData
  38. {
  39.   V_STRING MenuTextANSI;            // default:     "white"
  40.   V_STRING MenuOpenBracket;         // default: [   "blue + ["
  41.   V_STRING MenuCloseBracket;        // default: ]   "blue + ]"
  42.   V_STRING MenuHighlightANSI;       // default:     "yellow"
  43.   V_STRING MenuDefaultOptANSI;      // default:     "bold + white"
  44.   V_STRING MenuPromptANSI;          // default: :   "blue + :"
  45. };
  46.  
  47. // using the defaults above with the example above, the string that gets
  48. // printed looks like this:
  49. //
  50. // "Fruit [O]ranges, [B]ananas, [A]pples"
  51. //
  52. // as you can see, there is quite alot of scope for cool menu designs!
  53. // and you can have different settings for difference conferences and different nodes too !!
  54.  
  55.  
  56. struct BoolNode
  57. {
  58.   struct Node node;
  59.   V_BOOL Boolean;
  60. };
  61.  
  62. struct ConfAcsData
  63. {
  64.   V_STRING Name;
  65.   struct List *See; // Lists of BoolNode's
  66.   struct List *Access;  // Lists of BoolNode's
  67. };
  68.  
  69.  
  70. // when a user joins a conf first copy the correct access settings from
  71. // the list of access settings in BBSGlobal->AcsList (HBBS:Access/Level_XX
  72. // to Node->User.Acs then overwrite this data Using UpdateAcs(dest,new)
  73. // with the settings for the Node->Acs, (NodePath/Access/Level_XX)
  74. // then override these settings with the access settings from
  75. // the conference itself (ConfPath/Access/Level_XX), and finally
  76. // override these settings with the users own access settings.
  77.  
  78.  
  79. struct ConfData
  80.   {
  81.     // conference data is a linked list (see BBSGlobal->ConfList)
  82.     struct Node   node;
  83.  
  84.     // the conference's name is stored in node->ln_Name and loaded from the
  85.     // ConfName in the ConfConfig config file.
  86.     // makes it cool for intuition based utils  (nukers ?)
  87.     // MAXLEN: 25
  88.  
  89.     V_BIGNUM      ConfNum;    // filled in by Control, ranges from 1 to BBSGlobal->Conferences
  90.  
  91.     V_BOOL        ConfActive; // if set then you may use the conference
  92.                               // possible use is for cd-rom conferences, you could write
  93.                               // a door to de-activeate a conference if the cd was taken
  94.                               // out (but make sure there are NO users in that conference
  95.                               // when you modify this value.
  96.     V_SMALLNUM    ConfAccess; // access required to enter conference
  97.  
  98.     // Public : Path to conference (initialised from ConfList and NOT ConfConfig)
  99.     V_STRING      ConfPath;
  100.  
  101.     V_STRING      HoldFileList;   // path and filename of file that holds the list
  102.                               // of privately uploaded files
  103.     V_STRINGLIST  HoldFiles;  // path(s) to above files
  104.  
  105.     V_STRING      BadFileList; // same as hold but for bad/corrupt files
  106.     V_STRINGLIST  BadFiles;
  107.  
  108.     V_STRINGLIST  PartUpload; // path for uploaded files that were not completed
  109.  
  110.     V_STRINGLIST  FileList;   // file listings
  111.     V_BIGNUM      FileLists;  // contains amount of file lists..
  112.  
  113.     V_STRINGLIST  Upload;     // paths for uploaded files to go to..
  114.     V_STRINGLIST  Download;   // paths to download files from
  115.  
  116.     V_SMALLNUM    MaxDIZLines; // max lines for the file description
  117.  
  118.     V_STRING      MenuPrompt;  // prompt for the menu
  119.  
  120.     V_BOOL        AutoMailScan; // automatic mail scan ?
  121.  
  122.     V_STRING      ConfPassWD; // conference password
  123.  
  124.     V_STRINGLIST  UserAllowed; // list of users allowed, or NULL
  125.                                // if you want to allow every user access to the conf
  126.  
  127.     V_BOOL        KeepDIZWithFile; // if set it'll copy the FILE_ID.DIZ to the same
  128.                                    // directory as the file itself is stored.
  129.                                    // it's still kept in the archive too tho!
  130.   };
  131.  
  132.  
  133. // defines all data needed for the device for the node
  134.  
  135. struct DeviceData
  136.   {
  137.     V_BOOL SysopNode; // gets set to  TRUE if the Device file does not
  138.                       // exist in the nodes/nodex/ direcotry..
  139.                       // this determines wether we open the serial port
  140.  
  141.     // following settings are defined in nodex/device
  142.  
  143.     V_STRING DeviceName;  // as in name of modem rather than amiga .device!
  144.     V_STRING SerialDevice; // name/path of .device file..
  145.     V_BIGNUM SerialUnit;
  146.     V_BIGNUM SerialBaud;  // baud rate
  147.     V_BOOL ModemDebug;   // show inout/output to and from modem commands
  148.     V_BOOL ModemLog;  // log all input/output of modem commands
  149.  
  150.     V_SMALLNUM   EchoRetries;
  151.     V_SMALLNUM   ReOpenRetries;
  152.     V_BIGNUM     ReOpenDelay;
  153.     V_STRING     LockUpScript;
  154.  
  155.     V_BIGNUM     MaxCommandWait;
  156.     V_SMALLNUM   CommandRetries;
  157.     V_BIGNUM     DelayBetweenCmds;
  158.     V_BIGNUM     TildeDelay;
  159.  
  160.     V_STRINGLIST TurnOnEcho;
  161.     V_BIGNUM     TurnOnEchoDelay;
  162.  
  163.     V_STRINGLIST ModemInit;
  164.  
  165.     V_BOOL       StrictConnect;
  166.     V_STRINGLIST StrictConnectStr;
  167.     V_STRINGLIST RelaxedConnectStr;
  168.  
  169.     V_STRINGLIST CommandModeString;
  170.     V_BOOL       DropDTRHangup;
  171.     V_STRING     HangUpString;
  172.     V_STRING     OffHookString;
  173.     V_STRING     Incoming;
  174.     V_STRING     ImmediateAnswer;
  175.     V_BOOL       NullModemCable;   // show inout/output to and from modem commands
  176.   };
  177.  
  178. struct NodeSettingsData   // these settings are always in memory, even when
  179.                           // a node is closed (for stuff like lastcallers utils to examine)
  180.   {
  181.     V_STRING   SysopAccount;
  182.     V_STRING   NodeName;
  183.     V_STRING   NodePhone;
  184.     V_STRING   NodeConnectScript;
  185.  
  186.     V_BOOL     AskUserPW;
  187.  
  188.     V_BOOL     UseSysPW;
  189.     V_STRING   SysPW;
  190.     V_STRING   SysPWScript;
  191.     V_STRING   SysPWPrompt;
  192.  
  193.     V_BOOL     UseNodePW;
  194.     V_STRING   NodePW;
  195.     V_STRING   NodePWScript;
  196.     V_STRING   NodePWPrompt;
  197.  
  198.     V_STRING   UserNamePrompt;
  199.     V_STRING   UserPWPrompt;
  200.  
  201.     V_STRING   NodeLogFile;
  202.     V_STRING   ModemLogFile;
  203.     V_STRING   CallersLogFile;
  204.     V_STRING   DoorLogFile;
  205.     V_BOOL     DoorLog;
  206.     V_BOOL     UploadLog;
  207.     V_BOOL     DownloadLog;
  208.  
  209.     V_BOOL     ChatFlag;
  210.     V_BOOL     Iconified;
  211.     V_BOOL     UseOwnScreen;
  212.     V_BOOL     StartScreen;
  213.  
  214.     V_BIGNUM   ScrModeID;
  215.     V_BIGNUM   ScrWidth;
  216.     V_BIGNUM   ScrHeight;
  217.     V_BIGNUM   ScrDepth;
  218.  
  219.     V_SMALLNUM AccessRequired;
  220.  
  221.     V_BOOL     UseDevice;
  222.     V_BOOL     AllowNewUsers; // set to true if you want to allow new users to join.
  223.  
  224.     V_STRING   NodePlayPen;
  225.     V_SMALLNUM MaxDIZLines; // default max diz lines.  it gets copied to N_ND->MaxDizLines
  226.  
  227.     // MUCH more to come...
  228.  
  229.     // update stuff in source/common/shared.c
  230.   };
  231.  
  232. // struct for time access data, see BBSGlobal->TimesList for linked list of these...
  233.  
  234.  
  235. struct TimeAccessData
  236.   {
  237.     struct Node node;  // ln_Name contains the filename from which the data
  238.                        // was loaded, so that the filename in the users
  239.                        // user.data is matched to ln_Name to find the right one,
  240.                        // rather than searching/loading it everytime a user logs on..
  241.  
  242.     V_BOOL     Times[7][24];
  243.   };
  244. /*
  245.    times between 1:00am and 12:59pm
  246.         AM          PM
  247.         1         111         11
  248.         212345678901212345678901         a + here means a user can login during that
  249.     Mon +++++++++---------++++++         hour above the +, a - means the user is
  250.  d  Tue +++++++++---------++++++         NOT allowed to login..
  251.  a  Wed +++++++++---------++++++
  252.  y  Thu +++++++++---------++++++         so in this example the user would be able
  253.     Fri +++++++++---------++++++         to login between 12:00am and 8:59am and
  254.     Sat ++++++++++++++++++++++++         between 6:00pm and 11:59pm except on the
  255.     Sun ++++++++++++++++++++++++         weekend where they can login at anytime..
  256.         NIGHT     DAY      NIGHT
  257.                                          cool huh ?
  258. */
  259.  
  260. struct AccessData
  261.   {
  262.     V_SMALLNUM AccessLevel;
  263.     V_CHAR Data[MAX_ACCESSSETTINGS];  // currently 4096, see defines.h and access.h
  264.   };
  265.  
  266. // this is the file format of the userdata.hbbs file... :-) no more hunting
  267. // and hacking to find it out! YEah!!!!
  268.  
  269. // when memory is allocated for the userdata it should be MEMF_CLEAR'd
  270. // so that when it is written to the end or back to the userdata.hbbs
  271. // file it does not contain any garbage characters that would appear otherwise..
  272.  
  273. struct UserData
  274.   {
  275.     // note: users DON'T have any form of ID based upon position in the file
  276.     // but they do have ID, which is thier unique number that will always
  277.     // be the same even if the userdata file is tieded.
  278.  
  279.  
  280.  
  281.     V_BIGNUM   UserID;   // When a user joins the system they are given
  282.                          // a number, this number is BBSGlobal->LastUserNum+1
  283.                          // this number is garunteed to be unique
  284.                          // as this number goes up one everytime a new user
  285.                          // is added to the user data file, but never goes down
  286.                          // when users are removed.
  287.                          // The lastusernum itself is stored in
  288.                          // HBBS:System/Data/Private
  289.  
  290.     // see the flags USER_#? defined in <hbbs/defines.h>
  291.  
  292.     V_CHAR     Status;   // 'N' for new user      - the user is a new user..
  293.                          // 'V' for validated     - the sysop has validated the user
  294.                          // 'D' for deleted       - the sysop deleted the account
  295.                          // 'I' for inactive      - the account became inactive
  296.                          // 'L' for logins denied - user is not allowed to login.
  297.                          // 'O' for overwritable  - set if you want this account to
  298.                          //                         be erased by new accounts
  299.  
  300.     V_SMALLNUM Access;   // defines the users access level..
  301.  
  302.     // all arrays of V_CHAR are +1 for null terminator and should be allocated
  303.     // with a MEMF_CLEAR flag...
  304.  
  305.     V_CHAR     Handle[LEN_HANDLE+1];          // all obvious definitions..
  306.     V_CHAR     RealName[LEN_REALNAME+1];
  307.     V_CHAR     Group[LEN_GROUP+1];
  308.     V_CHAR     GeoLocation[LEN_GEOLOCATION+1];
  309.     V_CHAR     Country[LEN_COUNTRY+1];
  310.     V_CHAR     PhoneNumber[LEN_PHONENUMBER+1];
  311.     V_CHAR     Password[LEN_PASSWORD+1];    // not encrypted.. as if i did
  312.                                 // encrypt it some bugger would write a
  313.                                 // password hacker anyway!
  314.     V_CHAR     ComputerType[LEN_COMPUTERTYPE+1];  // note: this is a string, not a number!
  315.  
  316.     V_CHAR     SentBy[LEN_SENTBY+1]; // sentby string!  New, for Alpha A9
  317.  
  318.     V_CHAR     ConfAcsDataFile[LEN_CONFACCESSFILE+1];  // filename pointer to data for the access to
  319.                                                        // conferences, e.g. "NewUser"
  320.                // we look in HBBS:System/Data/ConfAcs for the above filename
  321.  
  322.                // note: this might be blank, if so the confjoiner program must check the access
  323.                // level of the conference the user wants to join.
  324.  
  325.                // this file is normally only used to disable/enable access to conferences
  326.                // without changing their access levels (which would enable more ACS_ commands)
  327.  
  328.  
  329.     V_CHAR     LeechAccDataFile[LEN_LEECHACCESSFILE+1];
  330.                // we look in HBBS:System/Data/LeechAcs for the above filename
  331.  
  332.     // below are the values the nukers should play with and all the doors
  333.     // should actually use to figure out stuff like weektops/conf tops/charts...
  334.  
  335.     // these are also used to work out the ratios and wether the user is over the
  336.     // limit or not..
  337.  
  338.     V_BIGNUM   UploadBytes;
  339.     V_BIGNUM   UploadFiles;
  340.     V_BIGNUM   DownloadBytes;
  341.     V_BIGNUM   DownloadFiles;
  342.  
  343.     // these numbers below are the ACTUAL ammount of bytes the user has transferred
  344.     // (via file transfer protocols like Zmodem) no doors should EVER change the
  345.     // values in these variables, treat them as is they were readonly..
  346.  
  347.     // they should be used for programs that work out the amount of bytes that
  348.     // have been uploaded to the system in a year, how many bytes have been nuked
  349.     // etc etc...
  350.  
  351.     V_BIGNUM   ActualUploadBytes;
  352.     V_BIGNUM   ActualUploadFiles;
  353.     V_BIGNUM   ActualDownloadBytes;
  354.     V_BIGNUM   ActualDownloadFiles;
  355.  
  356.     // dates for last upload and when the user last called.. great for spotting
  357.     // users who have uploaded loads and then turned into a leech!
  358.     // also so that doors can work out how many days since user last uploaded
  359.     // great for creating lists of lamers..
  360.  
  361.     // you could write a door that tells the user their account will expire in N
  362.     // days if they do not upload! cooool!
  363.  
  364.     LONG       LastUploadDate;
  365.     LONG       LastCalledDate; // use time() and localtime() on these..
  366.  
  367.     // some vars for bulletin/top chart makers! :-) hope this helps!
  368.  
  369.     V_BIGNUM   BestCPSUp;
  370.     V_BIGNUM   BestCPSDown;
  371.     V_BIGNUM   CallsMade;
  372.     V_BIGNUM   PagesMade;
  373.     V_BIGNUM   MessagesWritten;
  374.  
  375.  
  376.     V_SMALLNUM BytesRatio;   // as in N:1...
  377.     V_SMALLNUM FilesRatio;
  378.  
  379.     V_BIGNUM   LastConf;  // last conf user was in when they logged off..
  380.     V_BIGNUM   PreferedConf; // users prefered conference, if this is not set to 0
  381.                              // then join this conference instead of the conference
  382.                              // the user was last in...
  383.                              // conference joiner must check that this is a valid conf
  384.                              // numer and that the user has access to it before
  385.                              // joining it upon login.
  386.  
  387.     V_SMALLNUM LinesPerScreen; // obvious!
  388.  
  389.     V_SMALLNUM Protocol;    // number of protocol to use, if set to 0 then
  390.                             // the the bbs will ask the user what
  391.                             // protocol the user wishes to use for EVERY transfer
  392.  
  393.     V_SMALLNUM Editor;      // same as above except for editing text files...
  394.  
  395.     V_SMALLNUM ScreenType;  // use for enabling/disabling ansi colour..
  396.  
  397.     V_CHAR     TimeAccessFile[LEN_TIMEACCESS+1];
  398.                             // number of TimeAccess to use.. (defines when a user
  399.                             // can and can't login..
  400.                             // looks in HBBS:System/Data/TimeAcs for this file..
  401.  
  402.                             // note: match THIS name to the name in the BBSGlobal->TimeAcsList
  403.                             // nodes's ln_Name field rahter than loading each time as all access
  404.                             // data is loaded at control startup time.
  405.  
  406.     V_BIGNUM   ExtraTimeLimit;
  407.                             // if this is set then this number will be added to the
  408.                             // amount of time a user is allowed on-line
  409.                             // which is defined for each access level.. *I*mplement
  410.  
  411.     V_BIGNUM   ExtraBytesLimit;
  412.                             // this number is added to the amount of bytes the user
  413.                             // is allowed to download in one day which is defined
  414.                             // for each access level...
  415.  
  416.     V_BIGNUM   ExtraCallsLimit;
  417.                             // same as above except for calls a user is allowed to
  418.                             // make in one day
  419.     V_BIGNUM   ExtraChatLimit;
  420.                             // same as above except for chat time user allowed to
  421.                             // have per day
  422.  
  423.     V_BIGNUM   BytesAllowed;
  424.                             // amount of bytes user is allowed to download in one day.
  425.                             // if set to 0 then the user has unlimited
  426.                             // see TimeAllowed for some rules..
  427.     V_BIGNUM   TimeAllowed;
  428.                             // amount of time user is allowed in one day.
  429.                             // see
  430.  
  431.     V_BIGNUM   ChatAllowed;
  432.                             // amount of chat time user is allowed in one day.
  433.  
  434.     V_BIGNUM   CallsAllowed;
  435.                             // amount of calls a user is allowed to make in one day.
  436.  
  437.  
  438.     V_BIGNUM   TimeUsed;
  439.                             // total amount of time used today..
  440.                             // (so, to determine when to log off a user get the amount
  441.                             // of time a user is allowed per day from the access settings
  442.                             // for that level, then add the ExtraTimeLimit to that, then
  443.                             // take off the TimeUsed value and if it's <= 0 then log em off!
  444.  
  445.                             // The BBS Resets this value at 00:00am to 0 when the user is
  446.                             // online, the frontend must check the last called date with
  447.                             // todays date to determine wether or not to reset this
  448.                             // at logon time..
  449.  
  450.     V_BIGNUM   BytesUsed;
  451.                             // amount of bytes downloaded today. see timeused also.
  452.  
  453.     V_BIGNUM   CallsUsed;
  454.                             // amount of calls made today. see timeused also.
  455.  
  456.     V_BIGNUM   ChatUsed;
  457.                             // amount of chat time used today. see timeused also.
  458.  
  459.     V_CHAR     UserType;    // currently set to either
  460.                             // USERTYPE_NORMAL or USERTYPE_EXPERT
  461.                             // this is used by the CmdPrompt door to
  462.                             // decide wether or not to display the menu options
  463.                             // availiable to the user.  can also be used by
  464.                             // other programs
  465.  
  466.     V_BIGNUM   Language;    // Number of LanguageName/Extn to be used. (index starts at 1)
  467.  
  468.   }; // don't forget to update HBBSCommon.c/HBBS_InitUserData()
  469.  
  470. // conference flags for reading mail and scanning files are NOT in the user data
  471. // as this is upto the mail/file system to handle...
  472.  
  473.  
  474. struct NodeUser
  475.   {
  476.     BOOL Valid;  // if there is no user on-line then this will be FALSE
  477.                  // it is critical that all doors check this before accessing
  478.                  // any more data contained within this sructure.
  479.  
  480.     struct UserData NormalData;  // the user.data is loaded here first
  481.     struct UserData CallData;    // then copied to here. and THIS is the data
  482.                                  // most of your doors/programs should use
  483.                                  // to determine access and stuff as the sysop
  484.                                  // might want to override the access level
  485.                                  // settings for the call..
  486.  
  487.     struct TimeAccess *TimeAcs;  // only points to a TimeAccessData already loaded.
  488.     struct AccessData Acs;       // current access settings (dependant on
  489.                                  // Conference,Node and normal in that order..
  490.     struct ConfAcsData ConfAcs;  // set-up when user logs in.
  491.  
  492.     V_BIGNUM FilesUploaded;      // during this logon...
  493.     V_BIGNUM FilesDownloaded;
  494.     V_BIGNUM BytesUploaded;
  495.     V_BIGNUM BytesDownloaded;
  496.     V_BIGNUM PagesMade;
  497.     V_BIGNUM NukedFiles; // the amount of files other uses uploaded that the user has nuked
  498.     V_BIGNUM MsgsRead;
  499.     V_BIGNUM MsgsWritten;
  500.  
  501.   };
  502.  
  503. // sent between from a node to the control program
  504.  
  505. struct StatusMsg
  506.   {
  507.     struct Message message;
  508.     ULONG MsgType; // see nodemsg below..
  509.     V_BIGNUM NodeNum; //see nodemsg below
  510.     V_BIGNUM Status;
  511.   };
  512.  
  513. struct RequestMsg     // Message sent FROM a node to the control program
  514.   {
  515.     struct Message message;
  516.     ULONG MsgType; // see nodemsg below..
  517.     V_BIGNUM NodeNum; //see nodemsg below
  518.     ULONG Flags;
  519.   };
  520.  
  521. // used for communicating between a door and a node..
  522.  
  523. struct DoorIOMsg
  524.   {
  525.     struct Message message;
  526.     ULONG MsgType;
  527.     V_BIGNUM NodeNum;
  528.     ULONG Status;
  529.     UBYTE *Data; // null terminated string or data
  530.     ULONG DataLength; // length of data (above) in bytes
  531.     ULONG Flags;
  532.     ULONG ReturnVal;
  533.     UBYTE *OptionStr; // for sting options such as parameters for doors..
  534.     ULONG Num1;
  535.     ULONG Num2;
  536.   };
  537.  
  538. // tells the node when a door has started and when one has stopped.
  539.  
  540. struct DoorActivityMsg
  541.   {
  542.     struct Message message;
  543.     ULONG MsgType;
  544.     V_BIGNUM NodeNum;
  545.     ULONG Status;
  546.   };
  547.  
  548. // all messages sent to a CONTROL/NODE/DOOR program must contain these variables
  549. // so we know what's happening (and to aid message trace programs)...
  550.  
  551. struct NodeMsg
  552.   {
  553.     struct Message message;
  554.     ULONG MsgType;
  555.     V_BIGNUM NodeNum; // these three fields are contained in all the message structures that are passed
  556.                       // between the node and the control program, then depending on the TYPE field (see defines.h)
  557.   };                  // they are typecasted onto a different structure and passed to the correct subroutine to deal
  558.                       // with the message, for this reason these 3 fields MUST be present in any other messagetype
  559.                       // for the node program to deal them correctly (system MAY hang if you send a buggered msg...)
  560.  
  561. struct DoorData
  562.   {
  563.     struct Node node;
  564.     struct MsgPort *DoorPort;
  565.     struct MsgPort *ReplyPort;
  566.     UBYTE DoorPortName[20];
  567.     UBYTE *SystemOptions;
  568.   };
  569.  
  570. struct TimerData
  571.   {
  572.     struct Node node;
  573.     struct timerequest TR;
  574.   };
  575.  
  576. struct TimerSetupData
  577.   {
  578.     struct MsgPort *TimerPort;
  579.     struct timerequest *BlankTimerIO;
  580.     struct List *TimerList;
  581.     V_BOOL TimerOpen;
  582.  
  583.   };
  584.  
  585.  
  586.  
  587. struct NodeData
  588.   {
  589.     // private:
  590.     struct Node node; // for passing to list and for the ctrlwnd list view..
  591.  
  592.     // public:
  593.     V_BIGNUM Status;
  594.     V_SMALLNUM NodeNum;
  595.  
  596.     // private:
  597.     V_BOOL AutoStart;
  598.  
  599.     // private:
  600.     char PortName[15]; // port name for node, used to ask the node program stuff
  601.                        // by doors..
  602.  
  603.     // private:
  604.     char DoorStartPortName[25];
  605.  
  606.     // private:
  607.     struct MsgPort *NodePort,
  608.                    *ReplyPort,
  609.  
  610.                    *ConRPort,  // used by the console window for the node..
  611.                    *ConWPort,
  612.  
  613.                    *SerPort; // only one port for serial device needed...
  614.  
  615.     // private:
  616.     struct IOStdReq *ConRead,  // io requests for console window
  617.                     *ConWrite;
  618.  
  619.     // private:
  620.     struct IOExtSer *SerRead,  // io requests for serial port
  621.                     *SerWrite;
  622.  
  623.     // private:
  624.     struct TimerSetupData *NodeTimer; // timer io data for the node..
  625.  
  626.     // private:
  627.     struct Screen *ConScr;  // screen for watching a user..
  628.                             // note: this might be set to the same screen
  629.                             // as CtrlScr.. or even workbench screen :-)
  630.     // private:
  631.     struct Window *ConWin;  // window for above! :-)
  632.     // private:
  633.     struct Window *NodeWnd;
  634.     struct Window *InfoWnd;
  635.     struct Window *SettingsWnd;
  636.  
  637.     V_BIGNUM ConX,ConY,ConW,ConH,NodeX,NodeY;
  638.  
  639.     // public:
  640.     V_BOOL SettingsOpen;
  641.     V_BOOL InformationOpen;
  642.  
  643.     // private:
  644.     char WindowTitle[90];
  645.  
  646.     // public: will be set to true if console window for node is open!
  647.     // so if it's not you can call HBBS_OpenWatchWindow()
  648.     V_BOOL ConOK;
  649.  
  650.  
  651.     // private:
  652.     V_BOOL SerOK;
  653.  
  654.  
  655.     // private: used by init/cleanup routines to determine wether to call CloseDevice()...
  656.     V_BOOL SerOPEN;
  657.  
  658.     // private:
  659.     char *ConBuffer;    // console data is read in here (most of the time!)
  660.     ULONG ConBufferLen; // actual memory allocated to the console buffer
  661.     ULONG ConBytes;     // bytes of data waiting in ConBuffer
  662.  
  663.     // private:
  664.     char *SerBuffer;    // same as above but for the serial port!
  665.     ULONG SerBufferLen;
  666.     ULONG SerBytes;
  667.  
  668.     // private:
  669.     char *IBuffer;      // InputBuffer is set to conbuffer or SerBuffer
  670.                         // according to where input came from
  671.     // private:
  672.     ULONG IBytes;       // set to the amount of bytes awaiting to be parsed
  673.                         // in the Input buffer
  674.  
  675.     // private:
  676.     V_BOOL SerWaiting;  // if these flags are set then it main that an IORequest
  677.     V_BOOL ConWaiting;  // has been sent, this must be aborted and waitio()'d
  678.                         // before closing, and must be checked before
  679.                         // you CheckIO() the request.. or CRASH!!! :-)
  680.  
  681.     // private: used for csi's!
  682.     char char1;
  683.  
  684.  
  685.     // private: used for csi's!
  686.     char csistring[256];
  687.  
  688.  
  689.     // private:
  690.     ULONG TimerSig,       // signals for input events..
  691.           SerSig,
  692.           InfoWinSig,
  693.           SettingsWinSig,
  694.           ConSig,
  695.           ConWinSig,
  696.           PortSig,
  697.           WinSig;
  698.  
  699.     // public:  after you call DOOR_GetLine() this will contain the string
  700.     // that was typed in..
  701.     V_STRING CurrentLine;
  702.  
  703.     // public:  after you call DOOR_GetLine() with a GL_LINEWRAG flag this may
  704.     // contain some data if the user was in the middle or writing a word
  705.     // see the LineEditor for an example of it's usage.
  706.     V_STRING CurrentLineWrap;
  707.  
  708.     // public: type of logon, (local, remote or none!)
  709.     V_BIGNUM LoginType; // defaults to LOGIN_NONE
  710.  
  711.  
  712.     // private:
  713.     ULONG NodeFlags;   // some flags..  NFLG_#?
  714.  
  715.  
  716.     // private:
  717.     V_BOOL RequestShutdown;
  718.  
  719.  
  720.     // public: actual path of the NODEx directory.
  721.     UBYTE *NodeLocation; // path setting, should be initialized by CONTROL
  722.                          // MUST and WILL always have a trailing : or / ....
  723.  
  724.  
  725.     // public: options from the device file
  726.  
  727.     struct DeviceData NodeDevice;
  728.  
  729.  
  730.     // public: the following options are defines in the nodeglobal or nodelocal files.
  731.  
  732.     struct NodeSettingsData NodeSettings;
  733.  
  734.  
  735.     // public: info about the user who's online...
  736.     // check N_ND->User.Valid before accessing any more data! in the NodeUser structure
  737.  
  738.     struct NodeUser User;
  739.  
  740.  
  741.     // private: Amount of doors the node program currently has spawned.
  742.     ULONG DoorsRunning;
  743.  
  744.  
  745.     // public: pointer to doordata structure of the active door, most if the time
  746.     // this will point to some door of somekind.
  747.  
  748.     struct DoorData *ActiveDoor; // WARNING: NULL if door is not running,
  749.                                  // for the name of door look at N_ND->ActiveDoor->node.ln_Name;
  750.  
  751.     // private: String returned by last active door.
  752.     UBYTE  DoorReturn[LEN_MAXDOORRETURN];
  753.  
  754.     // private: List of doors
  755.  
  756.     struct List *DoorList; // as a door has the ability to spawn another door using GoDoor()
  757.                            // we need to keep track of the loaded doors and the order in
  758.                            // which we ran them, so the door at the START of the list
  759.                            // (the lh_Head) if the active door (which was loaded last)
  760.                            // the one at the end of the list if the one we loaded first.
  761.                            // so we add new doors to the START of the list..
  762.                            // (quicker to parse than having the active door at the end of the list..)
  763.  
  764.     // public: pointer to conference that user is in, WARNING: might be NULL if
  765.     // user has not yet joined one..
  766.  
  767.     struct ConfData *CurrentConf;
  768.  
  769.     // private:
  770.     // when a user logs into a node the access settings for that users level are
  771.     // loaded here, DO NOT use these setting to check wether a user can access
  772.     // things tho, use N_ND->User.Acs[X]
  773.  
  774.     // public:
  775.     UBYTE ConnectBaud[MAX_CPSBAUD_LEN+1];
  776.  
  777.     // public: used by WHO doors..
  778.     UBYTE Action[MAX_ACTION_LEN+1];
  779.  
  780.     V_BOOL TransferringFile;
  781.  
  782.     // public readable and door setable:  if a user is ONLINE (Via Local login or
  783.     // remote login then this will be set to OS_ONLINE.  Otherwise it will be set
  784.     // to OS_OFFLINE.  This variable is used by the node program to determine wether
  785.     // or not to continue running the next door in the sequnence or to reset the
  786.     // node...
  787.  
  788.     V_BOOL OnlineStatus;  // OS_ONLINE || OS_OFFLINE
  789.  
  790.     V_STRINGLIST Last_Callers;
  791.     V_STRINGLIST Last_Uploads;
  792.     V_STRINGLIST Last_Downloads;
  793.     V_STRINGLIST Last_Pagers;
  794.     V_STRINGLIST Last_PWFails;
  795.     V_STRINGLIST Last_Carrier;
  796.  
  797.     V_BIGNUM Max_Last_Callers,
  798.              Max_Last_Uploads,
  799.              Max_Last_Downloads,
  800.              Max_Last_Pagers,
  801.              Max_Last_PWFails,
  802.              Max_Last_Carrier;
  803.  
  804.     V_BIGNUM Current_Last_Callers,
  805.              Current_Last_Uploads,
  806.              Current_Last_Downloads,
  807.              Current_Last_Pagers,
  808.              Current_Last_PWFails,
  809.              Current_Last_Carrier;
  810.  
  811.     struct List *TaggedFileList; // list of struct TaggedFile's that is saved and
  812.                                  // reloaded, by the node program, when a user
  813.                                  // logs off and logs on respectivly
  814.     V_BIGNUM TaggedFiles; // number of tagged files (check when logging out ?)
  815.     V_SMALLNUM MaxDIZLines; // when a user is not in a conference then this is gained
  816.                             // from N_ND->NodeSettings.MaxDIZLines, otherwise it is
  817.                             // copied from N_ND->CurrentConf->MaxDIZLines
  818.     V_BOOL DoorContinue;
  819.  
  820.     V_BOOL AllowLogins;
  821.  
  822.     V_STRING CharsAllowed; // fill this with the characters you want the user to
  823.                            // be able to use when using DOOR_GetLine()
  824.                            // and specify GL_USECHARS as one of the flags
  825.                            // and when a user presses a key that's not in
  826.                            // this string a BEEP will be sent to their
  827.                            // system and the key will not be added to the currentline
  828.                            // (sort of like an edit hook, but not!)
  829.  
  830.     ULONG CallsToday; // saved in file: HBBS:System/Data/Misc.CFG as Node_X_Calls=
  831.  
  832.     struct List *OLMList;
  833.     V_BIGNUM OLMCount;     // also see NFLG_OLMSWAITING and "struct OLMNode"
  834.  
  835.     // private:
  836.     struct MsgPort *OLMPort;  // send a message to this port to make the bbs check
  837.                               // for OLM's!
  838.  
  839.     char Actions[LEN_ACTIONS+1]; // +1 for null terminator..
  840.                                // array of actions, check out the ACT_#? defines
  841.                                // in defines.h, basically it it set to a string
  842.                                // full of spaces upon node initialisation
  843.                                // and then actions are set if users run particular
  844.                                // types of door, this is SOOOOO handy for writing
  845.                                // lastcallers door,  this information is also
  846.                                // written to the callers log when a user logs off.
  847.     struct BBSColsData *BBSCols;
  848.                                // for setting colours of stuff like menu's etc..
  849.  
  850.     UBYTE LastCalledDate[LEN_DATESTR];
  851.     UBYTE LastCalledTime[LEN_TIMESTR];
  852.  
  853.     V_BOOL DoorLogOverride;
  854.   };
  855.  
  856. struct TaggedFile
  857.   {
  858.     struct Node node;  // ln_Name is the name of the file that's tagged
  859.     V_BIGNUM ConferenceNum; // the number of the conference that the file is in..
  860.     V_BIGNUM FileSize; // size of file (must be filled in or set to 0, this number
  861.                        // is used to determine if the user has enough creds to d/l and
  862.                        // will be added to thier bytes uploaded/downloaded total..
  863.     V_BOOL WarezFile; // if TRUE then bytes will be added to the ActualDownload#?
  864.                       // and Download#?, if false then bytes will only be added
  865.                       // to ActualDownload#?
  866.                       // (i.e. user does not loose creds if a non warez file..)
  867.  
  868.   };
  869.  
  870. // config files are read into memory and line by line are loaded into a linked
  871. // list of items and parameters, then to get a config option all we have to do
  872. // is search the linked list of items for a matching item name and return the params
  873. // in a desired format,  this works out much quicker than loading the config into mem
  874. // and parsing it everytime you want an option.. (which is how i did it to start with.
  875. // it's only when you try running it on a (lame) a500 that you realise how slow it
  876. // is to read in about 50-60 options when you start a node using the older method!
  877.  
  878. struct CfgItemData
  879.   {
  880.     struct Node node; // ln_name contains item name
  881.     UBYTE *Params;    // params contains the STRING of the parameter..
  882.   };
  883.  
  884. struct CfgFileData
  885.   {
  886.     struct List *ItemsList; // list of CfgItemData nodes
  887.     char *filename;
  888.   };
  889.  
  890. // because of the way HBBS data is stored in memory via linked varaibles *ANY*
  891. // program can access ALL DATA of the bbs and all of it's nodes at any time
  892. // just by getting a pointer to the following structure..
  893. // better than /X huh ? :-)
  894.  
  895. struct ProtocolNode
  896.   {
  897.     struct Node node;       // ln_Name is Protocol Name
  898.     V_BIGNUM protocoltype;  // PTYPE_BIDIRECTIONAL | PTYPE_UNIDIRECTIONAL
  899.     char *modulename;       // Name of door module to run
  900.     char *moduleopts;       // door options supplied to protocol module door
  901.     V_BOOL allow_ul;        // so you can specify a protocol is only availiable for
  902.     V_BOOL allow_dl;        // up load or download or both!
  903.     V_BOOL allow_batch;     // allow the transferring of more than one file at a time
  904.  
  905.   };
  906.  
  907. struct BBSGlobalData
  908.   {
  909.  
  910.     struct NodeData *NodeGlobalData;
  911.     struct List *NodeList;
  912.     struct MsgPort *CtrlMainPort,*CtrlMainReplyPort;
  913.     struct List *TimesList;
  914.     struct ScreenInfoData ScreenInfo;
  915.  
  916.     // settings for bbs, all sturctures are sub structures of this..
  917.  
  918.     // public: linked list of all Conference Data (struct ConfData *)
  919.     struct List *ConfList; // list of conferences.
  920.  
  921.     // public: amount of conferences (active or not) (initialised by Control)
  922.     V_BIGNUM Conferences;
  923.  
  924.  
  925.     // public: linked list of TimeAcs's (struct TimeAccessData *)
  926.     struct List *TimeAcsList;
  927.  
  928.     // public: amount of TimeAcs's loaded
  929.     V_BIGNUM TimeAccesses;
  930.  
  931.     // public: list of access levels
  932.     V_STRINGLIST AcsLevelList;        // ln_Name contains a string of the access level number
  933.     V_STRINGLIST AcsLevelNames;       // ln_Name contains a string of the access level name
  934.     V_STRINGLIST AcsLevelConfAcsDef;  // ln_Name contains a string of the name of the default
  935.                                       // conference access level settings file
  936.     // public: amount of access levels
  937.     V_BIGNUM AcsLevels;
  938.  
  939.     // public readonly: amount of users in the user database.
  940.     V_BIGNUM TotalUsers;
  941.  
  942.     V_STRING ErrorLogFile;
  943.  
  944.     V_BIGNUM BBSNodes;
  945.     V_STRING BBSName;
  946.     V_BIGNUM BBSSerial;
  947.     V_STRING BBSLocation;
  948.     V_STRING BBSCountry;
  949.     V_STRINGLIST BBSGroup;
  950.  
  951.     V_STRING SysopAccount; // the name of the sysop...
  952.  
  953.     V_STRINGLIST Drive;
  954.  
  955.     V_STRING BBSDrive;
  956.     V_BIGNUM MinFreeSpace;
  957.     V_STRING NoFreeSpaceScript;
  958.     V_STRINGLIST ButtonName;
  959.     V_STRINGLIST ButtonCMD;
  960.  
  961.     V_BOOL HideScreen;
  962.  
  963.     V_STRING UserDataFileName;
  964.  
  965. //    V_SMALLNUM NewUserAccessLevel;
  966.     V_SMALLNUM MaxUsernameAttempts;
  967.     V_SMALLNUM MaxPasswordAttempts;
  968.     V_SMALLNUM MinPasswordLength;
  969.  
  970. //    V_BIGNUM NewUserConf;
  971.  
  972.     // readonly:  userid of the last user added to the system.
  973.     V_BIGNUM LastUserNum;
  974.  
  975.     V_STRINGLIST LanguageName;
  976.     V_STRINGLIST LanguageExtn;
  977.     V_BIGNUM Languages;
  978.  
  979.     struct List *ProtocolList;  // List of protocol information
  980.     int Protocols;              // Amount of protocols loaded
  981.  
  982.     V_STRING EditorCMD; // program to be used for editing text files!
  983.  
  984.     UBYTE LastCalledDate[LEN_DATESTR];
  985.     UBYTE LastCalledTime[LEN_TIMESTR];
  986.  
  987.     V_BIGNUM CallsToday; // saved in file: HBBS:System/Data/Calls.CFG
  988.                          // also saves Today=[datestr] in file
  989.     V_BIGNUM CopyBufferSize;
  990.  
  991.     V_BIGNUM CallsEver; // total amount of calls bbs has received!
  992.  
  993.  
  994.   };
  995.  
  996.  
  997. // an OLM door should check for the AccessLevel ACS_ALLOWOLM before a user is allowed
  998. // to send an OLM..  this is not part of HBBS_AddOLM() as you might want other
  999. // doors to send olm's (e.g. LogonAnnounce Doors..)
  1000.  
  1001. // (olm stands for OnLineMessage..)
  1002.  
  1003. struct OLMNode
  1004. {
  1005.   struct Node node;  // -> ln_Name contains the message, null terminated string, it *CAN* have \n's in it..
  1006.                      // -> use node.ln_Pri to set an OLM's priority!!!
  1007.                      // the higher the pri the nearer the top of the list
  1008.  
  1009.   UBYTE Handle[LEN_HANDLE+1]; // handle of the user who sent the olm
  1010.                               // handle does not have to be valid,
  1011.                               // but if you want to reply to an OLM
  1012.                               // then you MUST check to see if it's valid...
  1013.                               // reason: announce doors don't have handles :=)
  1014.   UBYTE Time[LEN_TIMESTR];    // time olm was sent is added here..
  1015.   UBYTE Date[LEN_DATESTR];    // date olm was sent is added here (in case it was sent at 11:59pm :-))
  1016.  
  1017.   UBYTE FromPRG[LEN_HANDLE+1]; // the name of the program that sent the door, note
  1018.                                // the length constraints.
  1019.   V_SMALLNUM FromNode;        // 0, for external program, or a N_ND->NodeNum+1
  1020.  
  1021.  
  1022. };
  1023.